package com.leo;

import com.jfoenix.controls.JFXComboBox;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;

import java.net.URL;

/**
 * @ClassName JFXComboBoxDemo
 * @Description
 * @Author wangss
 * @date 2020.11.26 11:14
 * @Version 1.0
 */
public class JFXComboBoxDemo extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        JFXComboBox<Label> jfxCombo = new JFXComboBox<Label>();

        jfxCombo.getItems().add(new Label("Java 1.8"));
        jfxCombo.getItems().add(new Label("Java 1.7"));
        jfxCombo.getItems().add(new Label("Java 1.6"));
        jfxCombo.getItems().add(new Label("Java 1.5"));

        jfxCombo.setPromptText("Select Java Version");
        jfxCombo.getStyleClass().add("custom-jfx-combo");

        AnchorPane an = new AnchorPane();
        an.getChildren().addAll(jfxCombo);

        AnchorPane.setTopAnchor(jfxCombo, 20.0);
        AnchorPane.setLeftAnchor(jfxCombo, 180.0);

        Scene scene = new Scene(an);
        URL url = this.getClass().getResource("/css/myStyle.css");
        scene.getStylesheets().add(url.toExternalForm());
        primaryStage.setScene(scene);
        primaryStage.setWidth(800);
        primaryStage.setHeight(650);
        primaryStage.setTitle("JFoeniX测试");
        primaryStage.show();
    }
}
